package com.zhouyipeng;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class BatchFori {


    static final int limit = 10;

    static final int size = 10000;

    public static void main(String[] args) {

        Set<Integer> set = new HashSet<>(size);
        for (int i = 0; i < size; i++) {
            set.add(i);
        }

        batch(set);
    }

    private static void batch(Set<Integer> set) {
        List<List<Integer>> retList = new ArrayList<>(size / limit);
        List<Integer> list = new ArrayList<>(set);

        for (int i = 0; i < list.size(); i += limit) {
            List<Integer> childList = new ArrayList<>();
            for (int j = i; j < (i + limit); j++) {
                childList.add(list.get(j));
            }
            retList.add(childList);
        }
        System.out.println(retList);
    }
}
